{extend name="public/base" /}

{block name="title"}<title>{if condition="$data"}{$Think.lang.edit}{else /}{$Think.lang.create}{/if}</title>{/block}

{block name="pjax_container"}
<section class="content-header">
    <h1>角色信息</h1>
    <ol class="breadcrumb">
        <li class="active"><i class="fa fa-dashboard"></i> 角色信息</li>
    </ol>
</section>
<section class="content">
    <div class="row">
        <div class="col-md-12">
            <form class="form-horizontal" method="POST" action="" onsubmit="return false" >
                <div class="nav-tabs-custom">
                    <ul class="nav nav-tabs">
                        <li class="active"><a href="#tab1" data-toggle="tab">{$Think.lang.base_param}</a></li>
                        <li class="pull-right"><a href="javascript:history.back(-1)" class="btn btn-sm" style="padding:10px 2px;"><i class="fa fa-list"></i> {$Think.lang.back}</a></li>
                    </ul>
                    <div class="tab-content">
                        <div class="tab-pane active" id="tab1">
                            <input type="hidden" name="id" value="{$data.id}" />
                            <div class="form-group">
                                <label class="col-sm-2 control-label">{$Think.lang.title}</label>
                                <div class="col-sm-7"><input class="form-control" name="title" value="{$data.title}" placeholder="{$Think.lang.title}"></div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">{$Think.lang.level}</label>
                                <div class="col-sm-7"><input class="form-control" name="level" value="{$data.level}" placeholder="{$Think.lang.level}"></div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">{$Think.lang.notation}</label>
                                <div class="col-sm-7"><input class="form-control" name="notation" value="{$data.notation}" placeholder="{$Think.lang.notation}"></div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">{$Think.lang.pic}</label>
                                <div class="col-sm-7">
                                    <div class="input-group">
                                        <input class="form-control" name="pic" value="{$data.pic}" placeholder="{$Think.lang.pic}" >
                                        <span class="input-group-btn">
                                            <a href="{$data.pic|default='/static/global/face/no-image.png'}" target="_blank" >
                                                <img src="{$data.pic|default='/static/global/face/no-image.png'}" style="height:34px; width:68px;" />
                                            </a>
                                            <button class="btn btn-success btn-flat up-btn" type="button" data-url="{:url('Uploads/upload')}?dir=image">
                                                <i class="fa fa-cloud-upload"> {$Think.lang.Upload}</i>
                                            </button>
                                        </span>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">{$Think.lang.recom}</label>
                                <div class="col-sm-7">
                                    <select class="form-control select2" name="recom" style="width:100%;">
                                        <option value="0" {if condition="$data.recom eq '0'"}selected="selected"{/if} >{$Think.lang.yes_no0}</option>
                                        <option value="1" {if condition="$data.recom eq '1'"}selected="selected"{/if} >{$Think.lang.yes_no1}</option>
                                    </select>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">{$Think.lang.module}</label>
                                <div class="col-sm-7">
                                    <select class="form-control select2" name="module" style="width:100%;">
                                        <option value="admin" {if condition="$data.module eq 'admin'"}selected="selected"{/if} >{$Think.lang.module_admin}</option>
                                        <option value="member" {if condition="$data.module eq 'member'"}selected="selected"{/if} >{$Think.lang.module_member}</option>
                                    </select>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">{$Think.lang.status}</label>
                                <div class="col-sm-7">
                                    <select class="form-control select2" name="status" style="width:100%;">
                                        <option value="1" {if condition="$data.status eq '1'"}selected="selected"{/if} >{$Think.lang.status1}</option>
                                        <option value="0" {if condition="$data.status eq '0'"}selected="selected"{/if} >{$Think.lang.status0}</option>
                                    </select>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">{$Think.lang.rules}</label>
                                <div class="col-sm-7 rule_node">
                                {volist name="authRuleTree" id="rule_list"}
                                <p class='left{$rule_list.level} {if condition="$rule_list.level eq 3"} p_left{/if}' >
                                <label class="checkbox-inline">
                                    <input type="checkbox" name="rules[]" value="{$rule_list.id}" class="minimal" {if condition="isset($rule_list.ischeck) &&$rule_list.ischeck eq 'y'"}checked="checked"{/if} > {$rule_list.title}
                                </label>
                                </p>
                                {/volist}
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="box-footer">
                        <div class="col-sm-2"></div>
                        <div class="col-sm-7">
                            <div class="btn-group pull-right">
                                <button type="submit" class="btn btn-info pull-right submits" data-loading-text="&lt;i class='fa fa-spinner fa-spin '&gt;&lt;/i&gt; {$Think.lang.submit}">{$Think.lang.submit}</button>
                            </div>
                            <div class="btn-group pull-left">
                                <button type="reset" class="btn btn-warning">{$Think.lang.reset}</button>
                            </div>
                        </div>
                    </div>
                </div>
            </form>
        </div>
    </div>
</section>
<script type="text/javascript">
$(function(){
    /*ajax页面加载icheck，有该控件的页面才需要*/
    $('input[type="checkbox"].minimal, input[type="radio"].minimal').iCheck({
        checkboxClass: 'icheckbox_minimal-blue',
        radioClass: 'iradio_minimal-blue'
    });
    
    /*ajax页面加载icheck，有该控件的页面才需要*/
    $(".select2").select2({language:"zh-CN"});
    
    {if condition=" $rest_login == 1 "}
    restlogin('{$rest_login_info}');   //登录超时
    {/if}
})
</script>
{/block}